<?php use_helper('OpenSocial'); ?>
<?php //use_helper('Javascript'); ?>
<?php use_helper('OpenSocialRequest'); ?>
<?php use_helper('OpenSocialResponse'); ?>

<script type="text/javascript">
function <?php echo $request_func ?>()
{
  pending('<?php echo $update_div ?>','Loading user...');
  var req = opensocial.newDataRequest();
  var opt_params = { };
  opt_params[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] = [opensocial.Person.Field.PROFILE_URL];
  req.add(req.newFetchPersonRequest(opensocial.DataRequest.PersonId.<?php echo $person_type ?>,opt_params),"<?php echo $person_type_var ?>");
  <?php echo oSSendDataRequest($response_func) ?>
}
</script>

<div id="<?php echo $update_div ?>">Actualiza-me..</div>
<a href="javascript: <?php echo $request_func ?>()">View <?php echo $person_type ?>!</a>

<script type="text/javascript">
  function <?php echo $response_func ?>(data) {
    var <?php echo $person_type_var ?> =  <?php echo oSGetData(data,$person_type_var) ?>
    var name = <?php echo oSGetPersonName($person_type_var) ?>
    var thumb = <?php echo oSGetPersonThumbnailURL($person_type_var) ?>
    var profile = <?php echo oSGetPersonProfileURL($person_type_var) ?>
    var id = <?php echo oSGetPersonId($person_type_var) ?>
    var isOwner = <?php echo oSGetPersonIsOwner($person_type_var) ?>
    var isViewer = <?php echo oSGetPersonIsViewer($person_type_var) ?>
        
    var html = '<img src="' + thumb + '"/>' + 
                   '<a href="' + profile + '" target="_top">' + name + ' id:' + id +' isOwner:' + isOwner +' isViewer:' + isViewer + ' </a>';

    document.getElementById('<?php echo $update_div ?>').innerHTML = html;
    adjustHeight();
  }
</script>
